<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
<script type="text/javascript" src="js/JnPakg.js"></script>
<script type="text/javascript">
(function(){
	dw("06_valueOf_toString的妙处.html");
})();

//利用this的特性来创建一个Map类
function Map(){
	this.put = function(key,value){
		this[key] = value;
	};
	this.get = function(key){
		return this[key];
	};
	/**
	this.length = {
		valueOf:function(){return "孔卫佳"},
		toString:function(){return "孔卫佳"}
	};**/
}
Map.prototype.size = 10;
Map.prototype.getPram = function(){
	for(var i in this){
		dw("Map的参数有"+i);
	}
}

var map = new Map();
map.getPram();
map.put("1","一");
map.put("1","二");
dw(map.get("1"));
dw(map.get("2"));
dw(map.length);
map.getPram();
</script>
</html>